package com.lanou.controller;

import com.lanou.bean.BlogBean;
import com.lanou.bean.UserBean;
import com.lanou.service.BlogService;
import com.lanou.service.imp.BlogServiceImp;
import com.lanou.utils.AjaxResult;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * Created by dllo on 18/2/28.
 */
@Controller
public class BlogController {
    @Resource
    private BlogService blogService;

    @ResponseBody
    @RequestMapping(value = "/state", method = RequestMethod.GET)
    public AjaxResult pageHome(HttpServletRequest request) {
        AjaxResult result = new AjaxResult();
        UserBean user = (UserBean) request.getSession().getAttribute("user");
        String name = user.getName();
        System.out.println(user + "*******************");
        result.setMsg(name);
        return result;
    }

    @RequestMapping("/write")
    private String pageWrite(){
        return "write";
    }

    @RequestMapping("/writedown")
    public String pageWriteDown(){

        return "homepage";
    }

}
